-
Notifications
You must be signed in to change notification settings - Fork 8
Remove Plugwise switch-groups - use HA group-helper to create switch-groups instead #978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughSkip creating sensor and switch entities for devices whose dev_class is "report" or "switching"; update tests/snapshots and version/metadata accordingly. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
custom_components/plugwise/switch.py (1)
95-110: Switch-group blocking guard is correctly placed and safeThe added
dev_classfilter cleanly skips creating switch entities for"report"/"switching"devices, after verifying the device has switches, and safely handles missingdev_classvia.get(). This matches the PR goal of blocking switch-groups in favor of HA’s group helper without impacting other devices.custom_components/plugwise/sensor.py (1)
480-495: Sensor filtering matches switch behavior and aligns with intentThe new
dev_classcheck uses the same"report"/"switching"filter as inswitch.py, applied after confirming sensors are present. This keeps group/report devices from exposing sensors while leaving normal devices untouched, which fits the documented “block switch-groups, use HA group helper instead” intent.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
custom_components/plugwise/sensor.py(1 hunks)custom_components/plugwise/switch.py(1 hunks)tests/components/plugwise/snapshots/test_switch.ambr(0 hunks)tests/components/plugwise/test_init.py(3 hunks)
💤 Files with no reviewable changes (1)
- tests/components/plugwise/snapshots/test_switch.ambr
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 671
File: custom_components/plugwise/switch.py:82-83
Timestamp: 2024-10-08T15:35:25.180Z
Learning: User bouwew prefers to ignore exception handling suggestions for the `pw-beta` branch in the `custom_components/plugwise/switch.py` file.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 671
File: custom_components/plugwise/switch.py:82-83
Timestamp: 2024-06-22T08:05:56.791Z
Learning: User bouwew prefers to ignore exception handling suggestions for the `pw-beta` branch in the `custom_components/plugwise/switch.py` file.
📚 Learning: 2024-09-27T09:48:30.890Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 734
File: tests/components/plugwise/test_config_flow.py:58-58
Timestamp: 2024-09-27T09:48:30.890Z
Learning: In `tests/components/plugwise/test_config_flow.py`, the versions are mocked firmware versions for testing purposes and do not need to match the software version in `manifest.json`.
Applied to files:
tests/components/plugwise/test_init.py
📚 Learning: 2024-10-08T15:35:25.180Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 671
File: custom_components/plugwise/switch.py:82-83
Timestamp: 2024-10-08T15:35:25.180Z
Learning: User bouwew prefers to ignore exception handling suggestions for the `pw-beta` branch in the `custom_components/plugwise/switch.py` file.
Applied to files:
custom_components/plugwise/switch.py
🧬 Code graph analysis (3)
tests/components/plugwise/test_init.py (1)
tests/components/plugwise/conftest.py (1)
mock_config_entry(81-95)
custom_components/plugwise/switch.py (1)
custom_components/plugwise/entity.py (1)
device(94-96)
custom_components/plugwise/sensor.py (1)
custom_components/plugwise/entity.py (1)
device(94-96)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Prepare and validate pre-commit
🔇 Additional comments (1)
tests/components/plugwise/test_init.py (1)
298-305: Entity/device count expectations correctly updated to match new filteringThe reduced entity (51→50, 58→57) and device (10→9, 11→10) counts in all three assertion blocks are consistent with skipping devices having
dev_class"report"or"switching". The test still exercises the add/remove flow for the extra Tom/Floor device; this looks good and aligned with the integration changes.Also applies to: 322-329, 349-356
CoMPaTech
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
c4c7acc to
277169e
Compare
|
|
Not a good solution, closing this attempt. |



Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.